package com.cuit.qx.controller;

import com.cuit.qx.entity.InterfaceMonitoring;
import com.cuit.qx.service.InterfaceMonitoringService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cuit.qx.utils.ReturnData;
import com.cuit.qx.utils.ReturnStateCode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ：long
 * @date ：Created in 2021/11/25 0025 15:12
 * @description：
 */
@CrossOrigin(origins = "*", maxAge = 3600)
@RequestMapping("/api/interfaceMonitoring")
@RestController
public class InterfaceMonitoringController {

    @Autowired
    private InterfaceMonitoringService inter;

    @RequestMapping("/list")
    public ReturnData getList(){
        List<InterfaceMonitoring> list =  inter.list();
        if (list!=null && list.size()>0) {
            return new ReturnData(ReturnStateCode.SUCCEE.getCode(), ReturnStateCode.SUCCEE.getMsg(), list);
        } else {
            return new ReturnData(ReturnStateCode.FAILED.getCode(), ReturnStateCode.FAILED.getMsg(), new ArrayList<>());
        }
    }









}
